package com.txd.mofa.adapter;

import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
import android.widget.ImageView;
import android.widget.LinearLayout;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.txd.mofa.R;
import com.txd.mofa.view.MyJzvdStd;

import java.util.Map;



public class ShipinBofangAdapter extends BaseQuickAdapter<Map<String,String>, BaseViewHolder> {

    public ShipinBofangAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(BaseViewHolder helper, Map<String, String> item) {

        LinearLayout ll = helper.getView(R.id.ll);
        MyJzvdStd jzvdStd = helper.getView(R.id.mp_video);
        if (item.get("flag") != null){
            if (item.get("flag").equals("111")){
                jzvdStd.setUp(item.get("video_url"), "");
//                if (helper.getPosition() == 0) {
                    jzvdStd.startVideo();
//                }
//                jzvdStd.thumbImageView.setImageResource(R.mipmap.test);
                Glide.with(mContext).load(R.mipmap.test4).into(jzvdStd.thumbImageView);
                jzvdStd.thumbImageView.setScaleType(ImageView.ScaleType.CENTER_CROP);

            }
        }

        DisplayMetrics dm2 = mContext.getResources().getDisplayMetrics();
        System.out.println("heigth2 : " + dm2.heightPixels);



        ll.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,dm2.heightPixels));
//        helper.setText(R.id.tv_dizhi,item.get("video_location"));
//        helper.setText(R.id.tv_name,item.get("hm_account"));
//        helper.setText(R.id.tv_zan_shu,item.get("click_number"));
//        helper.setText(R.id.tv_pinglun_shu,item.get("comment_number"));
//        helper.setText(R.id.tv_fenxiang_shu,item.get("share_number"));
//        helper.setText(R.id.tv_biaoti,item.get("video_title"));
//        Glide.with(mContext).load(item.get("head_pic")).into((CircleImageView) helper.getView(R.id.iv));
//
//        ImageView zan = helper.getView(R.id.iv_zan);
//
//        if (Boolean.parseBoolean(item.get("is_click"))) {
//            zan.setImageResource(R.mipmap.zan_hong);
//        } else {
//            zan.setImageResource(R.mipmap.dianzan);
//        }
//
//
//        helper.addOnClickListener(R.id.iv_cha);
//        helper.addOnClickListener(R.id.iv_pingjia);
//        helper.addOnClickListener(R.id.tv_pingjia);
//        helper.addOnClickListener(R.id.iv_fenxiang);
//        helper.addOnClickListener(R.id.iv_zan);

//        holder.mp_video.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View v) {
//                holder.recyclerView.setVisibility(View.GONE);
//                holder.view.setVisibility(View.GONE);
//            }
//        });



    }
}
